package com.liu.designmode.completeable;

import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class Task {

    public void countOrRpc() {
        try {
            System.out.println(Thread.currentThread().getName() + " 执行任务");
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

    public String countOrRpc(TaskReq taskReq) {
        try {
            System.out.println(Thread.currentThread().getName() + " 执行任务");
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return "OK";
    }
}
